<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/_template.xhtml">

        <ui:define name="titulo">

            <h3>Cadastro de Documentos</h3>

        </ui:define>

        <ui:define name="conteudo">

            <p:growl autoUpdate="true" />
            <h:form>

                <p:messages id="messages" autoUpdate="true" />

                <p:fieldset legend="Dados do Documento" styleClass="fieldsetSms">

                    <h:panelGrid columns="2">
                        <h:outputLabel value="Nome:"  for="descricao" styleClass="rotulos"/>                                
                        <p:inputText id="descricao" value="#{documentoBean.documento.descricao}"
                                     required="true"
                                     requiredMessage="Campo obrigatório."
                                     validatorMessage="O nome só pode conter 50 caracteres." 
                                     maxlength="50" size="50" >
                            <f:validateLength maximum="50" />
                            <f:ajax event="blur" render="messages" />
                        </p:inputText>
                        
                    </h:panelGrid>
                    <br />
                    <p:commandButton value="Salvar" action="#{documentoBean.salvar()}" />
                    <p:commandButton value="Consultar" action="#{documentoBean.consultaDocumentos()}" immediate="true" />
                    <p:commandButton value="Cancelar" action="#{documentoBean.formPrincipal()}" immediate="true" />
                </p:fieldset>

            </h:form>
        </ui:define>
    </ui:composition>

</html>